// Search模块小仓库

import { reqGetSearchInfo } from "@/api"

// state：仓库存储数据的地方
const state = {
  searchList:{
  }
}
// mutations:修改state的唯一手段
const mutations = {
  GETSEARCHLIST(state,searchList){
    state.searchList = searchList
  }
}
// actions:可以书写自己的业务逻辑，可以处理异步。
const actions = {
  async getSearchList(context){
    let result = await reqGetSearchInfo()
    if(result.code === 200){
      context.commit("GETSEARCHLIST",result.data)
    }
  }
}
// getters：理解为计算属性，用于简化仓库数据，让组建获取仓库的数据更加方便。
const getters = {
  goodsList(state){
    return state.searchList.goodsList
  },
  trademarkList(state){
    return state.searchList.trademarkList
  },
  attrslist(state){
    return state.searchList.attrslist
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters,
}
